<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>outrg</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="outq.html" title="outq" />
    <link rel="next" href="outs1.html" title="outs1" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">outrg</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="outq.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="outs1.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="outrg"></a>
      <div class="titlepage"></div>
      <a id="IndexOutrg" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">outrg</span>
        </h2>
        <p>outrg — 
      Allow output to a range of adjacent audio channels on the audio output device
    </p>
      </div>
      <div class="refsect1">
        <a id="idp131674352"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>outrg</em></span> outputs audio to a range of adjacent audio channels on the audio output device.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp131676048"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>outrg</strong></span> kstart, aout1 [,aout2, aout3, ..., aoutN]</pre>
      </div>
      <div class="refsect1">
        <a id="idp131749968"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kstart</em></span> - the number of the first channel of the output device to be accessed (channel numbers starts with 1, which is the first channel)
    </p>
        <p>
      <span class="emphasis"><em>aout1, aout2, ... aoutN</em></span> - the arguments containing the audio to be output to the corresponding output channels.
    </p>
        <p>
      <span class="emphasis"><em>outrg</em></span> allows to output a range of adjacent channels to the output device. <span class="emphasis"><em>kstart</em></span> indicates the first channel to be accessed (channel 1 is the first channel). The user must be sure that the number obtained by summing kstart plus the number of accessed channels -1 is &lt;= <a class="link" href="nchnls.html" title="nchnls"><em class="citetitle">nchnls</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp131755184"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the outrg opcode. It uses the file <a class="ulink" href="examples/outrg.csd" target="_top"><em class="citetitle">outrg.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp131757040"></a>
          <p class="title">
            <strong>Example 590. Example of the outrg opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac    <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o outrg.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 4        <span class="comment">;quad</span>
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kleft <span class="opc">init</span> 1
asig  <span class="opc">vco2</span> .5, 220			<span class="comment">;sawtooth</span>
idur <span class="op">=</span> p3<span class="op">/</span>(<span class="ohdr">nchnls</span><span class="op">-</span>1)
knext <span class="opc">init</span> idur
kpos <span class="opc">init</span> 0
krate <span class="opc">init</span> 1<span class="op">/</span>idur
kbase <span class="opc">init</span> 0
ktime <span class="opc">timeinsts</span>
<span class="octrl">if</span> ktime<span class="op">&gt;=</span>knext then
  kleft <span class="op">=</span> kleft <span class="op">+</span> 1
  knext <span class="op">=</span> knext <span class="op">+</span> idur
  kpos <span class="op">=</span> 0
  kbase <span class="op">=</span> ktime
<span class="octrl">else</span>
  kpos <span class="op">=</span> (ktime<span class="op">-</span>kbase)<span class="op">/</span>idur
<span class="octrl">endif</span>
<span class="opc">printks</span> "speaker <span class="op">%</span>d position <span class="op">%</span>f\n", 0, kleft, kpos
a1,a2 <span class="opc">pan2</span> asig, kpos
      <span class="opc">outrg</span>  kleft, a1, a2
kpos <span class="op">=</span> kbase<span class="op">/</span>idur
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 10
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
        Its output should include lines like these:
      </p>
        <pre class="screen">
speaker 1 position 0.000200
speaker 1 position 0.000400
speaker 1 position 0.000600
.....
speaker 1 position 1.000000
speaker 2 position 0.000000
speaker 2 position 0.000200
....
speaker 2 position 0.999800
speaker 3 position 0.000000
speaker 3 position 0.000200
....
speaker 3 position 0.999600
speaker 4 position 0.000000
.....</pre>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp131762288"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 5.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="outq.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="outs1.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">outq </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> outs1</td>
        </tr>
      </table>
    </div>
  </body>
</html>
